package org.example.design.chainofresponsibility.test1;

/**
 * @author huangshen
 * @version 0
 * @description 解决编号小于limit值的问题
 * @since 2022/2/10 11:04
 */
public class LimitSupport extends Support {

    private final int limit;

    public LimitSupport(String name, int limit) {
        super(name);
        this.limit = limit;
    }

    /**
     * 解决问题的方法
     *
     * @param trouble
     * @return boolean
     */
    @Override
    protected boolean resolve(Trouble trouble) {
        return trouble.getNumber() < limit;
    }
}
